<%-- 
    Document   : risultatoRicerca
    Created on : 9-ago-2010, 15.33.04
    Author     : edoardo
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	try {
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Lista utenti</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="webmasterneo" />
<meta name="description"
	content="A short description of your site here." />
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="scripts/prototype.js"></script>
<script type="text/javascript" src="scripts/tts.js">
</script>

</head>

<body>

<div id="header">
	<div class="header"></div>
</div>

<div id="menu">
<div class="menu"><a href="adminConsole.do">Home</a></div>
	<div class="menu"><a href="wizardCreateUser.do">Crea utente</a></div>
<div class="menu"><a href="cercaUtente.do">Cerca</a></div><!-- cercaUtente.do -->
<div class="menu"><a href="esci.do">Esci</a></div>
<div class="menu"></div>
</div>

<div id="body"><!--div class="submenu"><a href="#">Sub Menu1</a> / <a href="#">Sub Menu2</a> / <a href="#">Sub Menu3</a></div-->
<div class="spacer"></div>
<div class="content"><c:choose>

	<c:when test="${not empty listaUtenti}">
	<%
if(request.getAttribute("passwordAzzerata")!=null){
%>
	<table width="100%">
		<tr>
			<td>
			<%=request.getAttribute("passwordAzzerata")%>
			</td>
		</tr>
	</table>
<%
}
%>
	
		<table width="100%">
		
			<tr style="border-bottom: thin">
				<td>USERNAME</td>
				<td>NOME</td>
				<td>COGNOME</td>
				<td>EMAIL</td>
				<td>PROFILO</td>
				<td>SOCIETA'</td>
				
				<!-- td>PROGETTI</td>
				<td>TICKETS</td-->
				<td></td>
				<td></td>
			</tr>

			<c:forEach items="${listaUtenti}" var="item">
				<tr>
					<td><c:out value="${item.username}" /></a></td>
					<td><c:out value="${item.cognome}" /></td>
					<td><c:out value="${item.nome}" /></td>
					<td><c:out value="${item.email}" /></td>
					<td><c:out value="${item.profilo.descrizione}" /></td>
					<td><c:out value="${item.societa.descrizione}" /></td>
					<!-- >td></td>
					<td></td-->
					<td><c:if
						test="${item.profilo.descrizione=='USER' || item.profilo.descrizione=='DEVELOPER'}">
						<a href="azzeraPassword.do?id=<c:out value='${item.idUtente}'/>">Azzera password</a>
					</c:if></td>
					<td>
					<c:if test="${item.profilo.descrizione!='ADMINISTRATOR'}">
						<c:choose>
						<c:when test="${item.abilitato }">
						<a href="javascript:changeStatoUtente('<c:out value="${item.idUtente }"/>','false','listaUtenti.do','')">
							Disabilita
							</a>
						</c:when>
						<c:otherwise>
						<a href="javascript:changeStatoUtente('<c:out value="${item.idUtente }"/>','true','listaUtenti.do','')">
							Abilita
							</a>
						</c:otherwise>
						</c:choose>
						</c:if>
					</td>
				</tr>
			</c:forEach>
			<table>
				<tr>
					<td align="right"><c:if test="${!currentPage.firstPage }">
						<a
							href="listaUtenti.do?p=<c:out value='${prevPage }' />&action=prev">prev</a>
					</c:if> <c:if test="${!currentPage.firstPage && !currentPage.lastPage }">	
				|</c:if> <c:if test="${!currentPage.lastPage }">
						<a
							href="listaUtenti.do?p=<c:out value='${nextPage }' />&action=next">next</a>
					</c:if></td>
					<td>Pagina <c:out value="${currentPage.page }" /> di <c:out
						value="${currentPage.pagineTotali}" /></td>
				</tr>
			</table>
		</table>
	</c:when>
	<c:otherwise>
		Nessun ticket trovato
	</c:otherwise>
</c:choose> <c:if test="${not empty storico }">
	<table width="100%" border="1">
		<c:forEach items="${storico}" var="item">
			<c:choose>
				<c:when test="${item.prossimaAzione==null }">
					<tr>
						<td width="10%"><fmt:formatDate value="${item.dataModifica }"
							pattern="dd/MM/yyyy" /></td>
						<td width="80%"><c:out value="${item.descrizione}"></c:out></td>
						<td width="10%"><c:if test="${not empty item.allegatis }">
							<a
								href="visualizzaListaAllegati.do?ids=<c:out value="${item.idStorico }"/>"
								target="_blank">Vedi allegati</a>
						</c:if></td>
					</tr>
				</c:when>
				<c:otherwise>
					<tr>
						<td width="10%"><fmt:formatDate value="${item.dataModifica }"
							pattern="dd/MM/yyyy" /></td>
						<td width="80%"><c:out value="${item.prossimaAzione}"></c:out></td>
						<td width="10%"><c:if test="${not empty item.allegatis }">
							<a
								href="visualizzaListaAllegati.do?ids=<c:out value="${item.idStorico }"/>"
								target="_blank">Vedi allegati</a>
						</c:if></td>
					</tr>
				</c:otherwise>
			</c:choose>
		</c:forEach>
	</table>
</c:if></div>
</div>

</body>

</html>
<%
	} catch (Exception e) {
		e.printStackTrace();
	}
%>
